package com.example.wemedia.service.impl;

import com.example.wemedia.dao.WmUserDao;
import com.example.wemedia.service.WmUserService;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.media.dtos.WmUserDto;
import com.usian.model.media.pojos.WmUser;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * impl wm用户服务
 */
@Service
public class WmUserServiceImpl implements WmUserService {
    @Autowired
    WmUserDao wmUserDao;
    
    /**
     * 添加wm用户
     *
     * @param wmUserDto wm用户dto
     */
    @Override
    public ResponseResult addWmUser(WmUserDto wmUserDto) {
        WmUser wmUser = new WmUser();
        BeanUtils.copyProperties(wmUserDto,wmUser);
        wmUser.setCreatedTime(new Date());
        int insert = wmUserDao.insert(wmUser);
        if (insert==1){
            return ResponseResult.okResult(200,"添加成功");
        }
        return ResponseResult.okResult(500,"有异常");
    }
}
